//准备好前
Win10.onPreInit(function () {
    //加载桌面图标
    loadDeskIcon();
});

//准备好后
Win10.onReady(function () {
    //设置壁纸
    Win10.setBgUrl({
        main: '/assets/plugins/win10/img/wallpapers/main.jpg',
        mobile: '/assets/plugins/win10/img/wallpapers/mobile.jpg',
    });

    Win10.setAnimated([
        'animated flip',
        'animated bounceIn',
    ], 0.01);

    setTimeout(function () {
        Win10.newMsg('官方交流一群', '欢迎各位大侠加入讨论：<a target="_blank" href="https://jq.qq.com/?_wv=1027&k=4Er0u8i">[点击加入]205546163</a>')
    }, 2500);

    setTimeout(function () {
        Win10.openUrl('//win10ui.yuri2.cn/src/broadcast.html', '<i class="fa fa-newspaper-o icon red"></i>最新文件', [['300px', '380px'], 'rt'])
    }, 2000);
});

//加载桌面图标
function loadDeskIcon() {
    $.ajax({
        url: config.base_server() + 'menus/current?access_token=' + config.getToken().access_token,
        type: 'GET',
        async: false,
        success: function (data) {
            if (!!data) {
                var $html = "";
                for (var i = 0; i < data.length; i++) {
                    $html += '<div class="shortcut win10-open-window" data-url="' + data[i].path +'" data-title="' + data[i].name +'">';
                    $html += '      <i class="icon ' + data[i].css + ' red"></i>';
                    $html += '    <div class="title">' + data[i].name + '</div>';
                    $html += ' </div>';
                }
                $("#win10-shortcuts").append($html);
            }
        }
    });
}

//该函数可删除 Orz
function win10_forgive_me() {
    Win10.enableFullScreen();
    layer.alert('点击展示下一版本特性', {}, function (index) {
        var blue = $('<img src="/assets/plugins/win10/img/presentation/bluescreen.jpg" style="position: fixed;width: 100%;height:100%;top:0;z-index:9999999999" />');
        setTimeout(function () {
            $('body').append(blue);
        }, 3000);
        setTimeout(function () {
            blue.remove();
            Win10.disableFullScreen();
            setTimeout(function () {
                layer.msg('开个玩笑，别打我');

            }, 1000);
        }, 7000);
        layer.close(index);
    });

}